import { hiprint } from 'vue-plugin-hiprint';

export const businessTypeMap = {
  '1': '拿货任务条码',
  '2': '库存商品条码',
  '34': '退货标签条码',
}

export const sizeMap = {
  1: '75#30',
  2: '75#30',
  3: '80#30',
  4: '80#30',
}

// 自定义设计元素1
export const aProvider = function (source = []) {
  
  var addElementTypes = function (context) {

    const goodsList = [], orderList = [], otherList = [], fields = [];

  source.map(item=>{
    if(item.type == 1){
      goodsList.push(item);
    }else if(item.type == 2){
      orderList.push(item);
    }else{
      otherList.push(item);
    }
    // fields.push({
    //   text: item.name,
    //   field: item.key
    // })
  })

    const collectionDataMaps = {
        '商品信息': goodsList,
        '订单信息': orderList,
        '其它信息': otherList,
    }

    // console.log(collectionDataMaps,'collectionDataMaps')

    const activeGroups = [];
    Object.keys(collectionDataMaps).map(item=>{
      const currentGroup = [];
      // console.log(collectionDataMaps[item])    

      collectionDataMaps[item].map(child=>{
        const { name, key } = child;
        currentGroup.push({
          tid: `aProviderModule.${key}`, title: name, data: '单据表头2', type: 'text',
          options: {
            // fields,
            field: key,
            testData: name,
            width: 72,
            height: 16,
            hideTitle: true
          }
        })
      })
      currentGroup?.length && activeGroups.push(new hiprint.PrintElementTypeGroup(item, currentGroup));
    })
    // console.log(activeGroups)
    context.removePrintElementTypes("aProviderModule");
    context.addPrintElementTypes("aProviderModule", activeGroups);
  };
  return { addElementTypes };
}

// 自定义设计元素1
export const aProvider1 = function (ops) {
  var addElementTypes = function (context) {

    context.removePrintElementTypes("aProviderModule");
    context.addPrintElementTypes(
      "aProviderModule",
      [
        new hiprint.PrintElementTypeGroup("商品信息", [
          {
            tid: 'aProviderModule.header', title: '单据表头1', data: '单据表头2', type: 'text',
            options: {
              testData: '单据表头',
              height: 17,
              fields: [
                { text: '名称', field: 'NAME' },
                { text: '数量', field: 'SL' },
                { text: '规格', field: 'GG' },
                { text: '条码', field: 'TM' },
                { text: '单价', field: 'DJ' },
                { text: '金额', field: 'JE' },
              ],
              textAlign: "center",
              hideTitle: true
            }
          },
          {
            tid: 'aProviderModule.type', title: '单据类型测试最大文字长度支持多少', data: '单据类型', type: 'text',
            options: {
              testData: '单据类型',
              height: 16,
              fontWeight: "600",
              hideTitle: true
            }
          },
          {
            tid: 'aProviderModule.order', title: '订单编号', data: 'XS888888888', type: 'text',
            options: {
              field: 'orderId',
              testData: 'XS888888888',
              height: 16,
              fontSize: 6.75,
              fontWeight: "700",
              textAlign: "left",
              textContentVerticalAlign: "middle"
            }
          },
          {
            tid: 'aProviderModule.date', title: '业务日期', data: '2020-01-01', type: 'text',
            options: {
              field: 'date',
              testData: '2020-01-01',
              height: 16,
              fontSize: 6.75,
              fontWeight: "700",
              textAlign: "left",
              textContentVerticalAlign: "middle"
            }
          },
          {
            tid: 'aProviderModule.barcode', title: '条形码', data: 'XS888888888', type: 'text',
            options: {
              field: 'barcode',
              testData: 'XS888888888',
              height: 32,
              fontSize: 12,
              lineHeight: 18,
              textType: "barcode"
            }
          },
          {
            tid: 'aProviderModule.qrcode', title: '二维码', data: 'XS888888888', type: 'text',
            options: {
              field: 'qrcode',
              testData: 'XS888888888',
              height: 32,
              fontSize: 12,
              lineHeight: 18,
              textType: "qrcode"
            }
          },
          {
            tid: 'aProviderModule.platform', title: '平台名称', data: '平台名称', type: 'text',
            options: {
              testData: '平台名称',
              height: 17,
              fontSize: 16.5,
              fontWeight: "700",
              textAlign: "center",
              hideTitle: true
            }
          },
          {tid: 'aProviderModule.logo', title: 'Logo', data: '', type: 'image', options: {
            src: "https://foruda.gitee.com/avatar/1677050350324030848/5400665_ccsimple_1591166830.png!avatar200",
          },},
        ]),
        new hiprint.PrintElementTypeGroup("订单信息", [
          {
            tid: 'aProviderModule.creater', title: '制单人', data: '李四', type: 'text',
            options: {
              field: 'creater',
              testData: '李四',
              height: 16,
              fontSize: 6.75,
              fontWeight: "700",
              textAlign: "left",
              textContentVerticalAlign: "middle"
            }
          },
          {
            tid: 'aProviderModule.printDate', title: '打印时间', data: '2022-01-01 09:00', type: 'text',
            options: {
              field: 'printDate',
              testData: '2022-01-01 09:00',
              height: 16,
              fontSize: 6.75,
              fontWeight: "700",
              textAlign: "left",
              textContentVerticalAlign: "middle"
            }
          },
          {
            tid: 'aProviderModule.signer', title: '库管签字', data: '', type: 'text',
            options: {
              title: '库管签字：',
              height: 16,
              fontSize: 6.75,
              fontWeight: "700",
              textAlign: "left",
              textContentVerticalAlign: "middle"
            }
          },
        ]),
        new hiprint.PrintElementTypeGroup("其它信息", [
          {
            tid: 'aProviderModule.creater', title: '制单人', data: '李四', type: 'text',
            options: {
              field: 'creater',
              testData: '李四',
              height: 16,
              fontSize: 6.75,
              fontWeight: "700",
              textAlign: "left",
              textContentVerticalAlign: "middle"
            }
          },
          {
            tid: 'aProviderModule.printDate', title: '打印时间', data: '2022-01-01 09:00', type: 'text',
            options: {
              field: 'printDate',
              testData: '2022-01-01 09:00',
              height: 16,
              fontSize: 6.75,
              fontWeight: "700",
              textAlign: "left",
              textContentVerticalAlign: "middle"
            }
          },
          {
            tid: 'aProviderModule.signer', title: '库管签字', data: '', type: 'text',
            options: {
              title: '库管签字：',
              height: 16,
              fontSize: 6.75,
              fontWeight: "700",
              textAlign: "left",
              textContentVerticalAlign: "middle"
            }
          },
        ]),
        // new hiprint.PrintElementTypeGroup("表格/其他", [
        //   {
        //     tid: 'aProviderModule.table', title: '订单数据',
        //     type: 'table',
        //     options: {
        //       field: 'table',
        //       tableHeaderRepeat: 'first',
        //       tableFooterRepeat: 'last',
        //       fields: [
        //         {text: '名称', field: 'NAME'},
        //         {text: '数量', field: 'SL'},
        //         {text: '规格', field: 'GG'},
        //         {text: '条码', field: 'TM'},
        //         {text: '单价', field: 'DJ'},
        //         {text: '金额', field: 'JE'},
        //       ],
        //     },
        //     editable: true,
        //     columnDisplayEditable: true,//列显示是否能编辑
        //     columnDisplayIndexEditable: true,//列顺序显示是否能编辑
        //     columnTitleEditable: true,//列标题是否能编辑
        //     columnResizable: true, //列宽是否能调整
        //     columnAlignEditable: true,//列对齐是否调整
        //     isEnableEditField: true, //编辑字段
        //     isEnableContextMenu: true, //开启右键菜单 默认true
        //     isEnableInsertRow: true, //插入行
        //     isEnableDeleteRow: true, //删除行
        //     isEnableInsertColumn: true, //插入列
        //     isEnableDeleteColumn: true, //删除列
        //     isEnableMergeCell: true, //合并单元格
        //     columns: [
        //       [
        //         {title: '名称', align: 'center', field: 'NAME', width: 150},
        //         {title: '数量', align: 'center', field: 'SL', width: 80},
        //         {title: '规格', align: 'center', field: 'GG', width: 80, checked: false},
        //         {title: '条码', align: 'center', field: 'TM', width: 100, checked: false},
        //         {title: '单价', align: 'center', field: 'DJ', width: 100},
        //         {title: '金额', align: 'center', field: 'JE', width: 100, checked: false},
        //       ],
        //     ],
        //     rowsColumnsMerge: function (data, col, index) {
        //       // 返回一个数组,参数一为行（rowspan）合并数,参数二为列（colspan）合并数, 被合并的行或者列值设为0
        //       if (index == 0) {
        //         return [1, data.INDEX % 2 == 1 ? 2 : 1]
        //       } else if (index > 0 && index < 2) {
        //         return [data.INDEX % 2 == 1 ? 0 : 1, 1]
        //       } else {
        //         return [data.INDEX % 2 == 1 ? 2 : 0, 1]
        //       }
        //     },
        //     footerFormatter: function (options, rows, data, currentPageGridRowsData) {
        //       if (data && data['totalCap']) {
        //         return `<td style="padding:0 10px" colspan="100">${'应收金额大写: ' + data['totalCap']}</td>`
        //       }
        //       return '<td style="padding:0 10px" colspan="100">应收金额大写: </td>'
        //     },
        //   },
        //   {tid: 'aProviderModule.customText', title: '文本', customText: '自定义文本', custom: true, type: 'text'},
        //   {
        //     tid: 'aProviderModule.longText', title: '长文本', type: 'longText', options: {
        //       field: 'test.longText',
        //       width: 200,
        //       testData: '长文本分页/不分页测试'
        //     },
        //   }
        // ]),
      ]
    );
  };
  return { addElementTypes };
};

// 自定义设计元素2
export const bProvider = function (fields) {
  var addElementTypes = function (context) {
    context.removePrintElementTypes("bProviderModule");
    context.addPrintElementTypes(
      "bProviderModule",
      [
        // new hiprint.PrintElementTypeGroup("常规", [
        //   {
        //     tid: 'bProviderModule.header', title: '单据表头', data: '单据表头', type: 'text',
        //     options: {
        //       testData: '单据表头',
        //       height: 17,
        //       fontSize: 16.5,
        //       fontWeight: "700",
        //       textAlign: "center",
        //       hideTitle: true
        //     }
        //   },
        //   {
        //     tid: 'bProviderModule.type', title: '单据类型', data: '单据类型', type: 'text',
        //     options: {
        //       testData: '单据类型',
        //       height: 16,
        //       fontSize: 15,
        //       fontWeight: "700",
        //       textAlign: "center",
        //       hideTitle: true
        //     }
        //   },
        //   {
        //     tid: 'bProviderModule.order', title: '订单编号', data: 'XS888888888', type: 'text',
        //     options: {
        //       field: 'orderId',
        //       testData: 'XS888888888',
        //       height: 16,
        //       fontSize: 6.75,
        //       fontWeight: "700",
        //       textAlign: "left",
        //       textContentVerticalAlign: "middle"
        //     }
        //   },
        //   {
        //     tid: 'bProviderModule.date', title: '业务日期', data: '2020-01-01', type: 'text',
        //     options: {
        //       field: 'date',
        //       testData: '2020-01-01',
        //       height: 16,
        //       fontSize: 6.75,
        //       fontWeight: "700",
        //       textAlign: "left",
        //       textContentVerticalAlign: "middle"
        //     }
        //   },
        //   {
        //     tid: 'bProviderModule.barcode', title: '条形码', data: 'XS888888888', type: 'text',
        //     options: {
        //       field: 'barcode',
        //       testData: 'XS888888888',
        //       height: 32,
        //       fontSize: 12,
        //       lineHeight: 18,
        //       textType: "barcode"
        //     }
        //   },
        //   {
        //     tid: 'bProviderModule.qrcode', title: '二维码', data: 'XS888888888', type: 'text',
        //     options: {
        //       field: 'qrcode',
        //       testData: 'XS888888888',
        //       height: 32,
        //       fontSize: 12,
        //       lineHeight: 18,
        //       textType: "qrcode"
        //     }
        //   },
        //   {
        //     tid: 'bProviderModule.platform', title: '平台名称', data: '平台名称', type: 'text',
        //     options: {
        //       testData: '平台名称',
        //       height: 17,
        //       fontSize: 16.5,
        //       fontWeight: "700",
        //       textAlign: "center",
        //       hideTitle: true
        //     }
        //   },
        //   {tid: 'bProviderModule.image', title: 'Logo', data: '', type: 'image'},
        // ]),
        // new hiprint.PrintElementTypeGroup("客户", [
        //   {
        //     tid: 'bProviderModule.khname', title: '客户名称', data: '高级客户', type: 'text',
        //     options: {
        //       field: 'name',
        //       testData: '高级客户',
        //       height: 16,
        //       fontSize: 6.75,
        //       fontWeight: "700",
        //       textAlign: "left",
        //       textContentVerticalAlign: "middle"
        //     }
        //   },
        //   {
        //     tid: 'bProviderModule.tel', title: '客户电话', data: '18888888888', type: 'text',
        //     options: {
        //       field: 'tel',
        //       testData: '18888888888',
        //       height: 16,
        //       fontSize: 6.75,
        //       fontWeight: "700",
        //       textAlign: "left",
        //       textContentVerticalAlign: "middle"
        //     }
        //   },
        // ]),
        // new hiprint.PrintElementTypeGroup("表格/其他", [
        //   {
        //     tid: 'bProviderModule.table', title: '订单数据',
        //     type: 'table',
        //     options: {
        //       field: 'table',
        //       fields: [
        //         {text: '名称', field: 'NAME'},
        //         {text: '数量', field: 'SL'},
        //         {text: '规格', field: 'GG'},
        //         {text: '条码', field: 'TM'},
        //         {text: '单价', field: 'DJ'},
        //         {text: '金额', field: 'JE'},
        //         {text: '备注', field: 'DETAIL'},
        //       ],
        //     },
        //     editable: true,
        //     columnDisplayEditable: true,//列显示是否能编辑
        //     columnDisplayIndexEditable: true,//列顺序显示是否能编辑
        //     columnTitleEditable: true,//列标题是否能编辑
        //     columnResizable: true, //列宽是否能调整
        //     columnAlignEditable: true,//列对齐是否调整
        //     columns: [
        //       [
        //         {title: '名称', align: 'center', field: 'NAME', width: 100},
        //         {title: '数量', align: 'center', field: 'SL', width: 100},
        //         {title: '条码', align: 'center', field: 'TM', width: 100},
        //         {title: '规格', align: 'center', field: 'GG', width: 100},
        //         {title: '单价', align: 'center', field: 'DJ', width: 100},
        //         {title: '金额', align: 'center', field: 'JE', width: 100},
        //         {title: '备注', align: 'center', field: 'DETAIL', width: 100},
        //       ]
        //     ],
        //     footerFormatter: function (options, rows, data, currentPageGridRowsData) {
        //       if (data && data['totalCap']) {
        //         return `<td style="padding:0 10px" colspan="100">${'应收金额大写: ' + data['totalCap']}</td>`
        //       }
        //       return '<td style="padding:0 10px" colspan="100">应收金额大写: </td>'
        //     },
        //   },
        //   {tid: 'bProviderModule.customText', title: '文本', customText: '自定义文本', custom: true, type: 'text'},
        //   {
        //     tid: 'bProviderModule.longText', title: '长文本', type: 'longText', options: {
        //       field: 'test.longText',
        //       width: 200,
        //       testData: '长文本分页/不分页测试'
        //     },
        //   }
        // ]),
        new hiprint.PrintElementTypeGroup("", [
          {tid: 'bProviderModule.customText', title: '自定义文本', customText: '自定义文本', custom: true, type: 'text',
          options: {
            width: 72,
            height: 18
          }
         },
          {tid: 'bProviderModule.image', title: '图片', data: 'http://hiprint.io/Content/assets/hi.png', type: 'image', 
            options: {
              width: 48,
              height: 48,
              src: 'http://hiprint.io/Content/assets/hi.png'
            }
          },
          {
            tid: 'bProviderModule.hline',
            title: '横线',
            type: 'hline'
          },
          {
            tid: 'bProviderModule.vline',
            title: '竖线',
            type: 'vline'
          },
          {
            tid: 'bProviderModule.barcode', title: '条形码', data: 'XS888888888', type: 'text',
            options: {
              fields,
              field: 'barcode',
              // field: fields[0]?.text,
              testData: 'XS888888888',
              width: 96,
              height: 24,
              fontSize: 10,
              lineHeight: 10,
              textType: "barcode"
            }
          },
          {
            tid: 'bProviderModule.qrcode', title: '二维码', data: 'XS888888888', type: 'text',
            options: {
              // field: 'qrcode',
              fields,
              testData: 'XS888888888',
              width: 32,
              height: 32,
              fontSize: 10,
              lineHeight: 10,
              textType: "qrcode"
            }
          },
          // {
          //   tid: 'bProviderModule.rect',
          //   title: '矩形',
          //   type: 'rect'
          // },
          // {
          //   tid: 'bProviderModule.oval',
          //   title: '椭圆',
          //   type: 'oval'
          // }
        ])
      ]
    );
  };
  return { addElementTypes };
};

// export default [
//   {
//     name: '配置常用字段',
//     value: 'aProviderModule',
//     f: aProvider()
//   },
//   {
//     name: '基础自定义字段',
//     value: 'bProviderModule',
//     f: bProvider()
//   }]

const defaultTemplate = "{\"panels\":[{\"name\":1,\"index\":0,\"width\":75,\"height\":30,\"paperFooter\":85.03937007874016,\"paperHeader\":0,\"printElements\":[{\"options\":{\"top\":0,\"left\":127.5,\"field\":\"waveName\",\"right\":201.3749771118164,\"title\":\"波次名称\",\"width\":82.5,\"bottom\":15,\"height\":15,\"hCenter\":7.5,\"vCenter\":165.3749771118164,\"testData\":\"波次名称\",\"hideTitle\":true},\"printElementType\":{\"type\":\"text\",\"title\":\"波次名称\"}},{\"options\":{\"top\":0,\"left\":1.5,\"field\":\"uniqueCode\",\"right\":124.125,\"title\":\"条形码\",\"width\":124.5,\"bottom\":22.62184715270996,\"height\":22,\"hCenter\":11.12184715270996,\"vCenter\":61.875,\"fontSize\":10,\"testData\":\"XS888888888\",\"textType\":\"barcode\",\"lineHeight\":10,\"qrCodeLevel\":0,\"coordinateSync\":false,\"widthHeightSync\":false},\"printElementType\":{\"type\":\"text\",\"title\":\"条形码\"}},{\"options\":{\"top\":25.5,\"left\":127.5,\"field\":\"orderGoodsCount\",\"title\":\"订单商品数量\",\"width\":40.5,\"height\":16,\"testData\":\"订单商品数量\",\"hideTitle\":true},\"printElementType\":{\"type\":\"text\",\"title\":\"订单商品数量\"}},{\"options\":{\"top\":27,\"left\":168,\"field\":\"delays\",\"right\":197.2499771118164,\"title\":\"延期标识\",\"width\":42,\"bottom\":43.75,\"height\":16,\"hCenter\":35.75,\"vCenter\":181.4999771118164,\"testData\":\"延期标识\",\"hideTitle\":true},\"printElementType\":{\"type\":\"text\",\"title\":\"延期标识\"}},{\"options\":{\"top\":34.5,\"left\":0,\"field\":\"wmsOrderSn\",\"right\":130.5,\"title\":\"仓库订单号\",\"width\":127.5,\"bottom\":43.86869430541992,\"height\":13.5,\"hCenter\":37.11869430541992,\"vCenter\":66.75,\"testData\":\"仓库订单号\",\"hideTitle\":true},\"printElementType\":{\"type\":\"text\",\"title\":\"仓库订单号\"}},{\"options\":{\"top\":45,\"left\":0,\"field\":\"orderGoodsName\",\"title\":\"订单商品名称\",\"width\":127.5,\"height\":24,\"testData\":\"订单商品名称\",\"hideTitle\":true},\"printElementType\":{\"type\":\"text\",\"title\":\"订单商品名称\"}},{\"options\":{\"top\":49.5,\"left\":132,\"field\":\"waveType\",\"right\":181.87181854248047,\"title\":\"波次类型\",\"width\":78,\"bottom\":76.86869430541992,\"height\":27,\"hCenter\":63.36869430541992,\"vCenter\":157.12181854248047,\"fontSize\":14.25,\"testData\":\"波次类型\",\"hideTitle\":true,\"fontWeight\":\"bold\",\"lineHeight\":14.25,\"qrCodeLevel\":0,\"coordinateSync\":false,\"widthHeightSync\":false},\"printElementType\":{\"type\":\"text\",\"title\":\"波次名称\"}},{\"options\":{\"top\":67.5,\"left\":0,\"field\":\"orderGoodsSpec\",\"right\":72.75,\"title\":\"订单规格属性\",\"width\":127.5,\"bottom\":81.24684143066406,\"height\":12,\"hCenter\":73.24684143066406,\"vCenter\":36.75,\"testData\":\"订单规格属性\",\"hideTitle\":true},\"printElementType\":{\"type\":\"text\",\"title\":\"订单规格属性\"}}],\"paperNumberTop\":64.5,\"paperNumberLeft\":136.5,\"watermarkOptions\":{},\"paperNumberContinue\":true,\"paperNumberDisabled\":true}]}"

//各大类默认模板映射
export const defaultTemplateMap = {
  0: "{\"panels\": [{\"name\": 1, \"index\": 0, \"width\": 70, \"height\": 30, \"orient\": 1, \"paperFooter\": 85.03937007874016, \"paperHeader\": 0, \"printElements\": [{\"options\": {\"top\": 6, \"left\": 4.5, \"field\": \"storeName\", \"right\": 205.5000002423734, \"title\": \"门店名称\", \"width\": 201, \"bottom\": 49.83462680177101, \"height\": 43.5, \"hCenter\": 28.08462680177101, \"vCenter\": 105.0000002423734, \"fontSize\": 18.75, \"testData\": \"常熟第一卖家纺品质超群店铺欢迎常来采购\", \"hideTitle\": true, \"textAlign\": \"center\", \"fontWeight\": \"bold\", \"lineHeight\": 18.75, \"qrCodeLevel\": 0, \"coordinateSync\": false, \"widthHeightSync\": false, \"textContentVerticalAlign\": \"middle\"}, \"printElementType\": {\"type\": \"text\", \"title\": \"门店名称\"}}, {\"options\": {\"top\": 49.5, \"left\": 31.5, \"field\": \"storeAddress\", \"right\": 188.83977581614903, \"title\": \"门店地址\", \"width\": 153, \"bottom\": 76.49999603182681, \"height\": 27, \"hCenter\": 62.99999603182681, \"vCenter\": 110.08977581614909, \"fontSize\": 10.75, \"testData\": \"sdfsfsdf\", \"hideTitle\": true, \"qrCodeLevel\": 0, \"coordinateSync\": false, \"widthHeightSync\": false}, \"printElementType\": {\"type\": \"text\", \"title\": \"自定义文本\"}}], \"paperNumberTop\": 64.5, \"paperNumberLeft\": 136.5, \"watermarkOptions\": {\"width\": 200, \"format\": \"YYYY-MM-DD HH:mm\", \"height\": 200, \"rotate\": 25, \"content\": \"\", \"fontSize\": \"14px\", \"fillStyle\": \"rgba(184, 184, 184, 0.3)\", \"timestamp\": false}, \"paperNumberContinue\": true, \"paperNumberDisabled\": true}]}",
  1: defaultTemplate,
  2: defaultTemplate,
  3: "{\"panels\": [{\"name\": 1, \"index\": 0, \"width\": 80, \"height\": 30, \"paperFooter\": 85.03937007874016, \"paperHeader\": 0, \"printElements\": [{\"options\": {\"top\": 1.5, \"left\": 1.5, \"field\": \"headCode\", \"right\": 126.00000019942787, \"title\": \"条形码\", \"width\": 127.5, \"bottom\": 31.81719168900804, \"fields\": [{\"text\": \"barcode\", \"field\": \"barcode\"}, {\"text\": \"无头码\", \"field\": \"headCode\"}, {\"text\": \"退货员\", \"field\": \"refundName\"}, {\"text\": \"退货快递单号\", \"field\": \"refundLogisticsNo\"}, {\"text\": \"退货快递名称\", \"field\": \"refundLogisticsCompany\"}, {\"text\": \"退货备注\", \"field\": \"refundRemark\"}, {\"text\": \"退货商品名称\", \"field\": \"refundGoodsName\"}, {\"text\": \"仓库订单号\", \"field\": \"wmsOrderSn\"}, {\"text\": \"系统订单号\", \"field\": \"omsOrderSn\"}, {\"text\": \"订单商品名称\", \"field\": \"orderGoodsName\"}, {\"text\": \"订单商品价格\", \"field\": \"orderPrice\"}, {\"text\": \"店铺订单号\", \"field\": \"outOrderSn\"}, {\"text\": \"订单所属店铺\", \"field\": \"ecStoreName\"}, {\"text\": \"订单快递公司\", \"field\": \"logisticsCompany\"}, {\"text\": \"商品门店名称\", \"field\": \"refundStoreName\"}, {\"text\": \"商品门店地址\", \"field\": \"refundStoreAddress\"}, {\"text\": \"门店名称\", \"field\": \"storeName\"}], \"height\": 28.5, \"hCenter\": 16.81719168900804, \"vCenter\": 63.75000019942787, \"fontSize\": 10, \"testData\": \"XS888888888\", \"textType\": \"barcode\", \"lineHeight\": 10, \"qrCodeLevel\": 0, \"coordinateSync\": false, \"widthHeightSync\": false}, \"printElementType\": {\"type\": \"text\", \"title\": \"条形码\"}}, {\"options\": {\"top\": 30, \"left\": 130.5, \"field\": \"refundName\", \"right\": 227.24739837646484, \"title\": \"退货员\", \"width\": 94.5, \"bottom\": 48.49478912353515, \"height\": 16, \"hCenter\": 40.49478912353515, \"vCenter\": 179.99739837646484, \"testData\": \"退货员\", \"hideTitle\": true}, \"printElementType\": {\"type\": \"text\", \"title\": \"退货员\"}}, {\"options\": {\"top\": 4.5, \"left\": 129, \"field\": \"refundStoreName\", \"right\": 222.50000762939453, \"title\": \"商品门店名称\", \"width\": 96, \"bottom\": 35.73957824707031, \"height\": 24, \"hCenter\": 19.239578247070312, \"vCenter\": 174.50000762939453, \"testData\": \"商品门店名称\", \"hideTitle\": true}, \"printElementType\": {\"type\": \"text\", \"title\": \"商品门店名称\"}}, {\"options\": {\"top\": 48, \"left\": 0, \"field\": \"refundStoreAddress\", \"right\": 224.99739837646484, \"title\": \"商品门店地址\", \"width\": 220.5, \"bottom\": 58.74479675292969, \"height\": 16, \"hCenter\": 50.74479675292969, \"vCenter\": 114.74739837646484, \"testData\": \"商品门店地址\", \"hideTitle\": true}, \"printElementType\": {\"type\": \"text\", \"title\": \"商品门店地址\"}}, {\"options\": {\"top\": 64.5, \"left\": 0, \"field\": \"refundRemark\", \"right\": 68.75000762939453, \"title\": \"退货备注\", \"width\": 223.5, \"bottom\": 82.98958587646484, \"height\": 16, \"hCenter\": 74.98958587646484, \"vCenter\": 32.75000762939453, \"testData\": \"退货备注\", \"hideTitle\": true}, \"printElementType\": {\"type\": \"text\", \"title\": \"退货备注\"}}], \"paperNumberTop\": 64.5, \"paperNumberLeft\": 136.5, \"watermarkOptions\": {}, \"paperNumberContinue\": true, \"paperNumberDisabled\": true}]}",
  4: "{\"panels\": [{\"name\": 1, \"index\": 0, \"width\": 80, \"height\": 30, \"paperFooter\": 85.03937007874016, \"paperHeader\": 0, \"printElements\": [{\"options\": {\"top\": -1.5, \"left\": 0, \"field\": \"uniqueCode\", \"right\": 95.25, \"title\": \"条形码\", \"width\": 121.5, \"bottom\": 23.25, \"fields\": [{\"text\": \"商品唯一码\", \"field\": \"uniqueCode\"}, {\"text\": \"无头码\", \"field\": \"headCode\"}, {\"text\": \"商品门店名称\", \"field\": \"refundStoreName\"}, {\"text\": \"商品门店地址\", \"field\": \"refundStoreAddress\"}, {\"text\": \"退货员\", \"field\": \"refundName\"}, {\"text\": \"退货快递单号\", \"field\": \"refundLogisticsNo\"}, {\"text\": \"退货快递名称\", \"field\": \"refundLogisticsCompany\"}, {\"text\": \"退货备注\", \"field\": \"refundRemark\"}, {\"text\": \"退货商品名称\", \"field\": \"refundGoodsName\"}, {\"text\": \"店铺订单号\", \"field\": \"outOrderSn\"}, {\"text\": \"系统订单号\", \"field\": \"omsOrderSn\"}, {\"text\": \"订单备注\", \"field\": \"orderRemark\"}, {\"text\": \"订单快递公司\", \"field\": \"logisticsCompany\"}, {\"text\": \"波次名称\", \"field\": \"waveName\"}, {\"text\": \"波次类型\", \"field\": \"waveType\"}, {\"text\": \"订单商品价格\", \"field\": \"orderPrice\"}, {\"text\": \"订单所属店铺\", \"field\": \"ecStoreName\"}, {\"text\": \"门店名称\", \"field\": \"storeName\"}], \"height\": 27, \"hCenter\": 11.25, \"vCenter\": 47.25, \"fontSize\": 10, \"testData\": \"XS888888888\", \"textType\": \"barcode\", \"lineHeight\": 10, \"qrCodeLevel\": 0, \"coordinateSync\": false, \"widthHeightSync\": false}, \"printElementType\": {\"type\": \"text\", \"title\": \"条形码\"}}, {\"options\": {\"top\": 0, \"left\": 126, \"field\": \"refundStoreName\", \"title\": \"商品门店名称\", \"width\": 97.5, \"height\": 16, \"testData\": \"商品门店名称\", \"hideTitle\": true}, \"printElementType\": {\"type\": \"text\", \"title\": \"商品门店名称\"}}, {\"options\": {\"top\": 16.5, \"left\": 126, \"field\": \"refundName\", \"right\": 222.73958587646484, \"title\": \"退货员\", \"width\": 97.5, \"bottom\": 33.242183685302734, \"height\": 16, \"hCenter\": 25.242183685302734, \"vCenter\": 173.98958587646484, \"testData\": \"退货员\", \"hideTitle\": true}, \"printElementType\": {\"type\": \"text\", \"title\": \"退货员\"}}, {\"options\": {\"top\": 34.5, \"left\": 0, \"field\": \"wmsOrderSn\", \"right\": 171, \"title\": \"仓库订单号\", \"width\": 220.5, \"bottom\": 54.99739837646485, \"height\": 16, \"hCenter\": 46.99739837646485, \"vCenter\": 85.5, \"testData\": \"仓库订单号\", \"hideTitle\": true}, \"printElementType\": {\"type\": \"text\", \"title\": \"仓库订单号\"}}, {\"options\": {\"top\": 49.5, \"left\": 0, \"field\": \"refundStoreAddress\", \"right\": 220, \"title\": \"商品门店地址\", \"width\": 220.5, \"bottom\": 68.24479675292969, \"height\": 16, \"hCenter\": 60.24479675292969, \"vCenter\": 109.75, \"testData\": \"商品门店地址\", \"hideTitle\": true}, \"printElementType\": {\"type\": \"text\", \"title\": \"商品门店地址\"}}, {\"options\": {\"top\": 64.5, \"left\": 0, \"field\": \"refundRemark\", \"title\": \"退货备注\", \"width\": 225, \"height\": 16, \"testData\": \"退货备注\", \"hideTitle\": true}, \"printElementType\": {\"type\": \"text\", \"title\": \"退货备注\"}}], \"paperNumberTop\": 64.5, \"paperNumberLeft\": 136.5, \"watermarkOptions\": {}, \"paperNumberContinue\": true, \"paperNumberDisabled\": true}]}"
}

//代拿任务条码的默认模版(普通用户和代拿)
export const defaultNahuoTemplateMap = {
    0: defaultTemplate,
    1: "{\"panels\":[{\"index\":0,\"name\":1,\"height\":30,\"width\":75,\"paperHeader\":0,\"paperFooter\":85.03937007874016,\"printElements\":[{\"options\":{\"left\":127.5,\"top\":0,\"height\":15,\"width\":82.5,\"field\":\"waveName\",\"right\":201.3749771118164,\"title\":\"波次名称\",\"bottom\":15,\"hCenter\":7.5,\"vCenter\":165.3749771118164,\"testData\":\"波次名称\",\"hideTitle\":true},\"printElementType\":{\"title\":\"波次名称\",\"type\":\"text\"}},{\"options\":{\"left\":1.5,\"top\":0,\"height\":22,\"width\":124.5,\"field\":\"uniqueCode\",\"right\":124.125,\"title\":\"条形码\",\"bottom\":22.62184715270996,\"hCenter\":11.12184715270996,\"vCenter\":61.875,\"fontSize\":10,\"testData\":\"XS888888888\",\"textType\":\"barcode\",\"lineHeight\":10,\"qrCodeLevel\":0,\"coordinateSync\":false,\"widthHeightSync\":false},\"printElementType\":{\"title\":\"条形码\",\"type\":\"text\"}},{\"options\":{\"left\":127.5,\"top\":25.5,\"height\":16,\"width\":40.5,\"field\":\"orderGoodsCount\",\"title\":\"订单商品数量\",\"testData\":\"订单商品数量\",\"hideTitle\":true},\"printElementType\":{\"title\":\"订单商品数量\",\"type\":\"text\"}},{\"options\":{\"left\":168,\"top\":27,\"height\":16,\"width\":42,\"field\":\"delays\",\"right\":197.2499771118164,\"title\":\"延期标识\",\"bottom\":43.75,\"hCenter\":35.75,\"vCenter\":181.4999771118164,\"testData\":\"延期标识\",\"hideTitle\":true},\"printElementType\":{\"title\":\"延期标识\",\"type\":\"text\"}},{\"options\":{\"left\":0,\"top\":34.5,\"height\":13.5,\"width\":127.5,\"field\":\"wmsOrderSn\",\"right\":130.5,\"title\":\"仓库订单号\",\"bottom\":43.86869430541992,\"hCenter\":37.11869430541992,\"vCenter\":66.75,\"testData\":\"仓库订单号\",\"hideTitle\":true},\"printElementType\":{\"title\":\"仓库订单号\",\"type\":\"text\"}},{\"options\":{\"left\":0,\"top\":45,\"height\":24,\"width\":127.5,\"field\":\"orderGoodsName\",\"title\":\"订单商品名称\",\"testData\":\"订单商品名称\",\"hideTitle\":true},\"printElementType\":{\"title\":\"订单商品名称\",\"type\":\"text\"}},{\"options\":{\"left\":132,\"top\":49.5,\"height\":27,\"width\":78,\"field\":\"waveType\",\"right\":181.87181854248047,\"title\":\"波次类型\",\"bottom\":76.86869430541992,\"hCenter\":63.36869430541992,\"vCenter\":157.12181854248047,\"fontSize\":14.25,\"testData\":\"波次类型\",\"hideTitle\":true,\"fontWeight\":\"bold\",\"lineHeight\":14.25,\"qrCodeLevel\":0,\"coordinateSync\":false,\"widthHeightSync\":false},\"printElementType\":{\"title\":\"波次名称\",\"type\":\"text\"}},{\"options\":{\"left\":135,\"top\":66,\"height\":16,\"width\":72,\"field\":\"omsShortName\",\"testData\":\"用户名简称\",\"hideTitle\":true,\"title\":\"用户名简称\",\"right\":205.82556187835607,\"bottom\":82.43021614714102,\"vCenter\":169.82556187835607,\"hCenter\":74.43021614714102,\"coordinateSync\":false,\"widthHeightSync\":false,\"qrCodeLevel\":0},\"printElementType\":{\"title\":\"用户名简称\",\"type\":\"text\"}},{\"options\":{\"left\":0,\"top\":67.5,\"height\":12,\"width\":127.5,\"field\":\"orderGoodsSpec\",\"right\":72.75,\"title\":\"订单规格属性\",\"bottom\":81.24684143066406,\"hCenter\":73.24684143066406,\"vCenter\":36.75,\"testData\":\"订单规格属性\",\"hideTitle\":true},\"printElementType\":{\"title\":\"订单规格属性\",\"type\":\"text\"}}],\"paperNumberLeft\":136.5,\"paperNumberTop\":64.5,\"paperNumberDisabled\":true,\"paperNumberContinue\":true,\"watermarkOptions\":{}}]}",
    2: "{\"panels\":[{\"index\":0,\"name\":1,\"height\":30,\"width\":75,\"paperHeader\":0,\"paperFooter\":85.03937007874016,\"printElements\":[{\"options\":{\"left\":4.5,\"top\":6,\"height\":43.5,\"width\":201,\"field\":\"storeName\",\"right\":205.5000002423734,\"title\":\"门店名称\",\"bottom\":49.83462680177101,\"hCenter\":28.08462680177101,\"vCenter\":105.0000002423734,\"fontSize\":18.75,\"testData\":\"常熟第一卖家纺品质超群店铺欢迎常来采购\",\"hideTitle\":true,\"textAlign\":\"center\",\"fontWeight\":\"bold\",\"lineHeight\":18.75,\"qrCodeLevel\":0,\"coordinateSync\":false,\"widthHeightSync\":false,\"textContentVerticalAlign\":\"middle\"},\"printElementType\":{\"title\":\"门店名称\",\"type\":\"text\"}},{\"options\":{\"left\":48,\"top\":49.5,\"height\":27,\"width\":153,\"field\":\"storeAddress\",\"right\":201.00001398359916,\"title\":\"门店地址\",\"bottom\":76.50000652467001,\"hCenter\":63.00000652467001,\"vCenter\":124.50001398359915,\"fontSize\":10.75,\"testData\":\"sdfsfsdf\",\"hideTitle\":true,\"qrCodeLevel\":0,\"coordinateSync\":false,\"widthHeightSync\":false},\"printElementType\":{\"title\":\"自定义文本\",\"type\":\"text\"}},{\"options\":{\"left\":10.5,\"top\":52.5,\"height\":25.5,\"width\":33,\"title\":\"代发\",\"right\":54.000010954828916,\"bottom\":81.6899473274958,\"vCenter\":32.250010954828916,\"hCenter\":67.4399473274958,\"field\":\"goodsType\",\"testData\":\"代发\",\"coordinateSync\":false,\"widthHeightSync\":false,\"hideTitle\":true,\"qrCodeLevel\":0},\"printElementType\":{\"title\":\"自定义文本\",\"type\":\"text\"}}],\"paperNumberLeft\":136.5,\"paperNumberTop\":64.5,\"paperNumberDisabled\":true,\"paperNumberContinue\":true,\"orient\":1,\"watermarkOptions\":{\"width\":200,\"format\":\"YYYY-MM-DD HH:mm\",\"height\":200,\"rotate\":25,\"content\":\"\",\"fontSize\":\"14px\",\"fillStyle\":\"rgba(184, 184, 184, 0.3)\",\"timestamp\":false}}]}"
  }

//各大类默认模板打印项映射
export const printItemsMap = {
  0: "[\"storeName\", \"storeAddress\"]",
  1: "[\"waveName\", \"uniqueCode\", \"orderGoodsCount\", \"delays\", \"wmsOrderSn\", \"orderGoodsName\", \"waveType\", \"orderGoodsSpec\"]",
  2: "[\"waveName\", \"uniqueCode\", \"orderGoodsCount\", \"delays\", \"wmsOrderSn\", \"orderGoodsName\", \"waveType\", \"orderGoodsSpec\"]",
  3: "[\"headCode\", \"refundName\", \"refundStoreName\", \"refundStoreAddress\", \"refundRemark\"]",
  4: "[\"uniqueCode\", \"refundStoreName\", \"refundName\", \"wmsOrderSn\", \"refundStoreAddress\", \"refundRemark\"]",
}

//代拿拿货打印的输出
export const printDaiNaItem =  "[\"waveName\", \"uniqueCode\", \"orderGoodsCount\", \"delays\", \"wmsOrderSn\", \"orderGoodsName\", \"waveType\", \"orderGoodsSpec\", \"omsShortName\"]";